<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateGreetTodayLogTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('greet_today_log', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->unsignedInteger('host_id')->default(0)->comment('打招呼的主播ID');
            $table->double('cost_coin', 3, 1)->default(0)->comment('搭讪的消费金币');
            $table->unsignedTinyInteger('type')->default(0)->comment('类型来源：0-免费，1-收费');
            $table->unsignedTinyInteger('flag')->default(1)->comment('状态');
            $table->timestamps();
            $table->index('user_id', 'user_id');
            $table->index('host_id', 'host_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('greet_today_log');
    }
}
